﻿#include "color_print.h"
void COLOR_PRINT(const char* s, int color)
{
    HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | color);
    printf(s);
    SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | 7);
    cout << endl;
}

void COLOR_PRINT(string s, int color, int sleepTime) {
    HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | color);
    for (auto it : s) {
        printf("%c",it);
        Sleep(sleepTime);
    }
    SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | 7);
    cout << endl;
}

void COLOR_PRINT_NOENDL(string s, int color) {
    HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | color);
    cout << s;
    SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | 7);
    
}